#!/usr/bin/env python

PACKAGE = 'astra_camera'

from dynamic_reconfigure.parameter_generator_catkin import *

gen = ParameterGenerator()

# TODO Only offer modes supported by known hardware
output_mode_enum = gen.enum([
    gen.const("1024_768_5", int_t, 1, "1024x768@5"),
    gen.const("1024_768_10", int_t, 2, "1024x768@10"),
    gen.const("1024_768_15", int_t, 3, "1024x768@15"),
    gen.const("1024_768_30", int_t, 4, "1024x768@30"),
    gen.const("1024_768_60", int_t, 5, "1024x768@60"),
    gen.const("1280_1024_5", int_t, 6, "1280x1024@5"),
    gen.const("1280_1024_10", int_t, 7, "1280x1024@10"),
    gen.const("1280_1024_15", int_t, 8, "1280x1024@15"),
    gen.const("1280_1024_30", int_t, 9, "1280x1024@30"),
    gen.const("1280_1024_60", int_t, 10, "1280x1024@60"),
    gen.const("1280_720_5", int_t, 11, "1280x720@5"),
    gen.const("1280_720_10", int_t, 12, "1280x720@10"),
    gen.const("1280_720_15", int_t, 13, "1280x720@15"),
    gen.const("1280_720_30", int_t, 14, "1280x720@30"),
    gen.const("1280_720_60", int_t, 15, "1280x720@60"),
    gen.const("1280_800_5", int_t, 16, "1280x800@5"),
    gen.const("1280_800_10", int_t, 17, "1280x800@10"),
    gen.const("1280_800_15", int_t, 18, "1280x800@15"),
    gen.const("1280_800_30", int_t, 19, "1280x800@30"),
    gen.const("1280_800_60", int_t, 20, "1280x800@60"),
    gen.const("160_120_5", int_t, 21, "160x120@5"),
    gen.const("160_120_10", int_t, 22, "160x120@10"),
    gen.const("160_120_15", int_t, 23, "160x120@15"),
    gen.const("160_120_30", int_t, 24, "160x120@30"),
    gen.const("160_120_60", int_t, 25, "160x120@60"),
    gen.const("240_180_5", int_t, 26, "240x180@5"),
    gen.const("240_180_10", int_t, 27, "240x180@10"),
    gen.const("240_180_15", int_t, 28, "240x180@15"),
    gen.const("240_180_30", int_t, 29, "240x180@30"),
    gen.const("240_180_60", int_t, 30, "240x180@60"),
    gen.const("320_180_5", int_t, 31, "320x180@5"),
    gen.const("320_180_10", int_t, 32, "320x180@10"),
    gen.const("320_180_15", int_t, 33, "320x180@15"),
    gen.const("320_180_30", int_t, 34, "320x180@30"),
    gen.const("320_180_60", int_t, 35, "320x180@60"),
    gen.const("320_200_5", int_t, 36, "320x200@5"),
    gen.const("320_200_10", int_t, 37, "320x200@10"),
    gen.const("320_200_15", int_t, 38, "320x200@15"),
    gen.const("320_200_30", int_t, 39, "320x200@30"),
    gen.const("320_200_60", int_t, 40, "320x200@60"),
    gen.const("320_240_5", int_t, 41, "320x240@5"),
    gen.const("320_240_10", int_t, 42, "320x240@10"),
    gen.const("320_240_15", int_t, 43, "320x240@15"),
    gen.const("320_240_30", int_t, 44, "320x240@30"),
    gen.const("320_240_60", int_t, 45, "320x240@60"),
    gen.const("480_360_5", int_t, 46, "480x360@5"),
    gen.const("480_360_10", int_t, 47, "480x360@10"),
    gen.const("480_360_15", int_t, 48, "480x360@15"),
    gen.const("480_360_30", int_t, 49, "480x360@30"),
    gen.const("480_360_60", int_t, 50, "480x360@60"),
    gen.const("512_384_5", int_t, 51, "512x384@5"),
    gen.const("512_384_10", int_t, 52, "512x384@10"),
    gen.const("512_384_15", int_t, 53, "512x384@15"),
    gen.const("512_384_30", int_t, 54, "512x384@30"),
    gen.const("512_384_60", int_t, 55, "512x384@60"),
    gen.const("640_360_5", int_t, 56, "640x360@5"),
    gen.const("640_360_10", int_t, 57, "640x360@10"),
    gen.const("640_360_15", int_t, 58, "640x360@15"),
    gen.const("640_360_30", int_t, 59, "640x360@30"),
    gen.const("640_360_60", int_t, 60, "640x360@60"),
    gen.const("640_400_5", int_t, 61, "640x400@5"),
    gen.const("640_400_10", int_t, 62, "640x400@10"),
    gen.const("640_400_15", int_t, 63, "640x400@15"),
    gen.const("640_400_30", int_t, 64, "640x400@30"),
    gen.const("640_400_60", int_t, 65, "640x400@60"),
    gen.const("640_480_5", int_t, 66, "640x480@5"),
    gen.const("640_480_10", int_t, 67, "640x480@10"),
    gen.const("640_480_15", int_t, 68, "640x480@15"),
    gen.const("640_480_30", int_t, 69, "640x480@30"),
    gen.const("640_480_60", int_t, 70, "640x480@60"),
    gen.const("160_100_5", int_t, 71, "160x100@5"),
    gen.const("160_100_15", int_t, 72, "160x100@15"),
    gen.const("160_100_30", int_t, 73, "160x100@30"),
    gen.const("160_100_60", int_t, 74, "160x100@60"),

], "output mode")

gen.add("edited_video_modes", str_t, 0, "edited video mode",
        output_mode_enum.replace("'", "\\\""))

video_stream_enum = gen.enum([
    gen.const("RGB", bool_t, True, "RGB video stream preferred"),
    gen.const("IR", bool_t, True, "IR video stream preferred")
], "preferred video stream mode")

gen.add("rgb_preferred",
        bool_t,
        0,
        "Preferred camera stream",
        True,
        edit_method=video_stream_enum)

gen.add("ir_mode",
        int_t,
        0,
        "Video mode for IR camera",
        68,
        1,
        74,
        edit_method=output_mode_enum)

gen.add("color_mode",
        int_t,
        0,
        "Video mode for color camera",
        68,
        1,
        74,
        edit_method=output_mode_enum)
gen.add("depth_mode",
        int_t,
        0,
        "Video mode for depth camera",
        69,
        1,
        74,
        edit_method=output_mode_enum)

gen.add("depth_align", bool_t, 0, "Hardware depth to color", False)
gen.add("color_depth_synchronization", bool_t, 0,
        "Synchronization of color and depth camera", False)
gen.add("auto_exposure", bool_t, 0, "Auto-Exposure", True)
gen.add("auto_white_balance", bool_t, 0, "Auto-White-Balance", True)

gen.add(
    "data_skip", int_t, 0,
    "Skip N images for every image published (rgb/depth/depth_registered/ir)",
    0, 0, 10)

gen.add("ir_time_offset", double_t, 0, "ir image time offset in seconds",
        -0.033, -1.0, 1.0)
gen.add("color_time_offset", double_t, 0, "color image time offset in seconds",
        -0.033, -1.0, 1.0)
gen.add("depth_time_offset", double_t, 0, "depth image time offset in seconds",
        -0.033, -1.0, 1.0)

gen.add("depth_ir_offset_x", double_t, 0,
        "X offset between IR and depth images", 5.0, -20.0, 20.0)
gen.add("depth_ir_offset_y", double_t, 0,
        "Y offset between IR and depth images", 4.0, -20.0, 20.0)

gen.add("z_offset_mm", int_t, 0, "Z offset in mm", 0, -200, 200)
gen.add("z_scaling", double_t, 0, "Scaling factor for depth values", 1.0, 0.5,
        1.5)

gen.add("use_device_time", bool_t, 0, "Use internal timer of OpenNI device",
        True)

gen.add("keep_alive", bool_t, 0, "Send keep alive message to device", False)

exit(gen.generate(PACKAGE, "Astra", "Astra"))
